package Question02;

public class BankAccount {
    String name;
    double money;

    public BankAccount(String name, double money) {
        this.name = name;
        this.money = money;
    }
    public void deposit(double amount){
        if(amount>0){this.money+=amount;}
    }
    public boolean withdraw(double amount){
        if(amount>0&&amount>this.money){
            System.out.println("余额不足，请重新操作");
            return false;
        }
        else{this.money-=amount;return true;}
    }
    public double getBalance(){
        return this.money;
    }
}
